|
![](/i/fill.gif) |
In article <403b27c6@news.povray.org>, Warp <war### [at] tag povray org>
wrote:
> > Of course, that assumes the compiler's too stupid to turn this into a
> > direct call in the case that there's no actual dynamic dispatch in the
> > program. Same kind of thing. Lazy compiler writers. ;-)
>
> If a member function has been declared virtual in C++, there's no way
> the compiler can know at compile time there will be no more than one
> derived class implementing that function.
However, there are cases where the compiler can figure out which
inherited implementation is desired and turn a member function call into
a static call, or even inline it. Pretty much whenever the exact type of
the object being referred to is known.
> It can't even theoretically
> check this at linking time because some code in a dynamic library (which
> may change in the future) may implement that virtual function.
C++ doesn't play particularly well with dynamic linking. C++ RTTI and
virtual functions can cause many problems with it.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tag povray org>
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |